<template>
	<image class="auto-img" @load="load" :src="src" :style="{width:width+'px',height:height+'px'}" mode="widthFix"></image>
</template>

<script>
	export default{
		props:{
			src:{
				type:String
			}
		},
		data(){
			return{
				width:0,
				height:0,
			}
		},
		methods:{
			//event.detail = {height:'图片高度px', width:'图片宽度px'}
			load(e){
				this.width = e.detail.width;
				this.height = e.detail.height;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.auto-img{
		max-width: 600upx;
	}
</style>
